<template>
  <section v-loading="loading" class="cms-body">
    <div class="cms-list-header flex-between">
      <el-button type="primary"
                 icon="el-icon-plus"
                 @click="routerLink('/cultureColumnist/save','save',0)"
                 v-perms="'/cultureColumnist/save'">添加
      </el-button>
      <!-- 右操作 -->
      <div>
        <cms-input label="作者名称" v-model="params.penName"></cms-input>
        <el-button @click="goSearch">查询</el-button>
      </div>
    </div>
    <!-- 表格 -->
    <el-table :data="tableData" stripe style="width: 100%" @selection-change="checkIds">
      <el-table-column type="selection" width="35" align="right"></el-table-column>
      <el-table-column prop="id" label="ID" width="50" align="center"></el-table-column>
      <el-table-column prop="penName" label="作者名称" align="center"></el-table-column>

      <el-table-column prop="userImg" label="头像" align="center">
        <template slot-scope="scope">
          <img-preivew :src="scope.row.userImg | imgPathFilter" :min-Width="50"></img-preivew>
        </template>
      </el-table-column>

      <el-table-column prop="descriptionImg" label="封面图" align="center">
        <template slot-scope="scope">
          <img-preivew :src="scope.row.descriptionImg | imgPathFilter" :min-Width="50"></img-preivew>
        </template>
      </el-table-column>
      <el-table-column prop="channelSort" label="排序值" align="center" width="45"></el-table-column>
      <el-table-column prop="createTime" label="创建时间" align="center" width="150"></el-table-column>

      <el-table-column prop="" label="是否展示" align="center" width="90">
        <div slot-scope="scope">
          <span v-if='scope.row.isShow==0'>不显示</span>
          <span v-if='scope.row.isShow==1'>显示</span>
        </div>
      </el-table-column>

      <el-table-column prop="name" label="操作" align="center" width="80">
        <div slot-scope="scope">
          <cms-button type="edit" @click.native="routerLink('/cultureColumnist/update','update',scope.row.id)" v-perms="'/cultureColumnist/update'"></cms-button>
          <cms-button type="delete" @click.native="deleteBatch($api.userDelete,scope.row.id)" v-perms="'/cultureColumnist/delete'"></cms-button>
        </div>
      </el-table-column>
    </el-table>
    <!-- 表格底部 -->
    <div class="cms-list-footer">
      <div class="cms-left"></div>
      <!-- cms分页组件 -->
      <cms-pagination :total="total" @change="getPages"></cms-pagination>
    </div>
  </section>
</template>

<script>
  import listMixins from '@/mixins/list'

  export default {
    mixins: [listMixins],
    data() {
      return {
        params: {//只需要业务参数
          penName: "",
          statu: "",
          pageNo: 1,
          pageSize: 10,
          departId: 5
        }
      };
    },
    methods: {
      goSearch(){
        this.initTableData(this.$api.userPageList, this.params);
      }
    },
    created() {
      this.initTableData(this.$api.userPageList, this.params);
    }
  };
</script>

<style>

</style>
